<template>
  <div>
    <swiper ref="mySwiper" :options="swiperOptions">
    <swiper-slide v-for="item in data" :key="item.id">
      <img :src="item.img" class="item-img" />
    </swiper-slide>
    <div class="swiper-pagination" slot="pagination"></div>
  </swiper>
  </div>
</template>

<script>
import { Swiper, SwiperSlide, directive } from 'vue-awesome-swiper'
import 'swiper/css/swiper.css'
export default {
  name: 'banner',
  components: {
    Swiper,
    SwiperSlide
  },
  directives: {
    swiper: directive
  },
  props: {
    data: Array
  },
  data () {
    return {
      swiperOptions: {
        autoplay: true,
        loop: true,
        pagination: {
          el: '.swiper-pagination',
          clickable: true,
          bulletActiveClass: 'my-bullet-active'
        }
      }
    }
  }
}
</script>

<style lang="scss" scoped>
 .item-img{
   width: 100%;
   height: 3.6rem;
  //  margin: 0.3rem 0;
 }
</style>
